class emiconfig::gridusers (
$create_homedir = false,
$homedir_path   = '/ihepbatch/gridfs1/home',
) {
  ####
  #
  #   Attention add new user must enabel create_dir  
  #
  ####

  if $create_homedir { 
   file {$homedir_path:
     ensure   => directory,
   }
  }
  class {'grid_accounts':
    create_dir => $create_homedir,
    resources   => {
      accounts      =>  true,
      gridmapdir    =>  true,
      gridmapfile  =>  true,
      groupmapfile  =>  true,
    },
    
    home_path  => $homedir_path,
    #create_dir => true,
   # enmr.eu     71001-71250
   # vo.france-a 71251-71450
   # alice       71501-71850
   # atlas       72001-72350
   # juno        73001-73450
   # juno glidein  73251
   # biomed      74001-74250
   #  cms        75001-75350
   # cepc        76001-76450
   # esr         77001-77250
   # ops         78001-78180
   # dteam       78201-78270
   # belle       79001-79250
   # ilc         79501-79850
   # lhcb        80001-80250
    pool_users => {
      '/alice'  => {
        ensure => 'present',
        group         => 'alice',
        gid           => '71501',
        vo_group      => 'alice',
        uid_range     => '71501-71700',
        users_num     => 200,
        comment       => 'grid user'
      },
      '/alice/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'alicesgm',
        gid           => '71502',
        vo_group      => 'alice',
        uid_range     => '71701-71710',
        users_num     => 10,
        comment       => 'grid user'
      },
      '/alice/ROLE=production' => {
        ensure        => 'present',
        group         => 'aliceprd',
        gid           => '71503',
        vo_group      => 'alice',
        uid_range     => '71711-71760',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/alice/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'alicepil',
        gid           => '71504',
        vo_group      => 'alice',
        uid_range     => '71801-71850',
        users_num     => 50,
        comment       => 'grid user'
      },
      #atlas
      '/atlas'  => {
        ensure => 'present',
        group         => 'atlas',
        gid           => '72001',
        vo_group      => 'atlas',
        uid_range     => '72001-72200',
        users_num     => 200,
        comment       => 'grid user'
      },
      '/atlas/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'atlassgm',
        gid           => '72002',
        vo_group      => 'atlas',
        uid_range     => '72201-72210',
        users_num     => 10,
        comment       => 'grid user'
      },
      '/atlas/ROLE=production' => {
        ensure        => 'present',
        group         => 'atlasprd',
        gid           => '72003',
        vo_group      => 'atlas',
        uid_range     => '72211-72260',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/atlas/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'atlaspil',
        gid           => '72004',
        vo_group      => 'atlas',
        uid_range     => '72301-72350',
        users_num     => 50,
        comment       => 'grid user'
      },
      #bell II
      '/belle'  => {
        ensure => 'present',
        group         => 'belle',
        gid           => '79001',
        vo_group      => 'belle',
        uid_range     => '79001-79050',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/belle/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'bellesgm',
        gid           => '79002',
        vo_group      => 'belle',
        uid_range     => '79101-79150',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/belle/ROLE=production' => {
        ensure        => 'present',
        group         => 'belleprd',
        gid           => '79003',
        vo_group      => 'belle',
        uid_range     => '79151-79200',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/belle/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'bellepil',
        gid           => '79004',
        vo_group      => 'belle',
        uid_range     => '79201-79250',
        users_num     => 50,
        comment       => 'grid user'
      },
      # ilc
      '/ilc'  => {
        ensure => 'present',
        group         => 'ilc',
        gid           => '79501',
        vo_group      => 'ilc',
        uid_range     => '79501-79700',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/ilc/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'ilcsgm',
        gid           => '79502',
        vo_group      => 'ilc',
        uid_range     => '79701-79710',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/ilc/ROLE=production' => {
        ensure        => 'present',
        group         => 'ilcprd',
        gid           => '79503',
        vo_group      => 'ilc',
        uid_range     => '79711-79750',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/ilc/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'ilcpil',
        gid           => '79504',
        vo_group      => 'ilc',
        uid_range     => '79751-79850',
        users_num     => 50,
        comment       => 'grid user'
      },
      #cepc
      '/cepc'  => {
        ensure => 'present',
        group         => 'cepc',
        gid           => '76001',
        vo_group      => 'cepc',
        uid_range     => '76001-76200',
        users_num     => 200,
        comment       => 'grid user'
      },
      '/cepc/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'cepcsgm',
        gid           => '76002',
        vo_group      => 'cepc',
        uid_range     => '76201-76250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/cepc/ROLE=production' => {
        ensure        => 'present',
        group         => 'cepcprd',
        gid           => '76003',
        vo_group      => 'cepc',
        uid_range     => '76301-76350',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/cepc/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'cepcpil',
        gid           => '76004',
        vo_group      => 'cepc',
        uid_range     => '76401-76450',
        users_num     => 50,
        comment       => 'grid user'
      },
      #cms
      '/cms'  => {
        ensure => 'present',
        group         => 'cms',
        gid           => '75001',
        vo_group      => 'cms',
        uid_range     => '75001-75200',
        users_num     => 200,
        comment       => 'grid user'
      },
      '/cms/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'cmssgm',
        gid           => '75002',
        vo_group      => 'cms',
        uid_range     => '75201-75210',
        users_num     => 10,
        comment       => 'grid user'
      },
      '/cms/ROLE=production' => {
        ensure        => 'present',
        group         => 'cmsprd',
        gid           => '75003',
        vo_group      => 'cms',
        uid_range     => '75211-75260',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/cms/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'cmspil',
        gid           => '75004',
        vo_group      => 'cms',
        uid_range     => '75301-75350',
        users_num     => 50,
        comment       => 'grid user'
      },
      #juno
      '/juno'  => {
        ensure => 'present',
        group         => 'juno',
        gid           => '73001',
        vo_group      => 'juno',
        uid_range     => '73001-73200',
        users_num     => 200,
        comment       => 'grid user'
      },
      '/juno/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'junosgm',
        gid           => '73002',
        vo_group      => 'juno',
        uid_range     => '73201-73250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/juno/ROLE=production' => {
        ensure        => 'present',
        group         => 'junoprd',
        gid           => '73003',
        vo_group      => 'juno',
        uid_range     => '73301-73350',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/juno/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'junopil',
        gid           => '73004',
        vo_group      => 'juno',
        uid_range     => '73401-73450',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/juno/ROLE=junoglidein'      => {
        ensure        => 'present',
        group         => 'junoglidein',
        gid           => '73251',
        vo_group      => 'juno',
        uid_range     => '73251-73251',
        users_num     => 1,
        comment       => 'junoglidein'
      },


      #lhcb

      '/lhcb'  => {
        ensure => 'present',
      	group         => 'lhcb',
      	gid           => '80001',
      	vo_group      => 'lhcb',
      	uid_range     => '80001-80050',
      	users_num     => 50,
      	comment       => 'grid user'
      },
      '/lhcb/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'lhcbsgm',
        gid           => '80002',
        vo_group      => 'lhcb',
        uid_range     => '80101-80150',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/lhcb/ROLE=production' => {
        ensure        => 'present',
        group         => 'lhcbprd',
        gid           => '80003',
        vo_group      => 'lhcb',
        uid_range     => '80151-80200',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/lhcb/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'lhcbpil',
        gid           => '80004',
        vo_group      => 'lhcb',
        uid_range     => '80201-80250',
        users_num     => 50,
        comment       => 'grid user'
      },
      # ops
      '/ops'  => {
        ensure => 'present',
        group         => 'ops',
        gid           => '78001',
        vo_group      => 'ops',
        uid_range     => '78001-78150',
        users_num     => 150,
        comment       => 'grid user'
      },
      '/ops/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'opssgm',
        gid           => '78002',
        vo_group      => 'ops',
        uid_range     => '78151-78160',
        users_num     => 5,
        comment       => 'grid user'
      },
      '/ops/ROLE=production' => {
        ensure        => 'present',
        group         => 'opsprd',
        gid           => '78003',
        vo_group      => 'ops',
        uid_range     => '78161-78170',
        users_num     => 5,
        comment       => 'grid user'
      },
      '/ops/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'opspil',
        gid           => '78004',
        vo_group      => 'ops',
        uid_range     => '78171-78180',
        users_num     => 5,
        comment       => 'grid user'
      },
      #dteam
      '/dteam'  => {
        ensure => 'present',
        group         => 'dteam',
        gid           => '78201',
        vo_group      => 'dteam',
        uid_range     => '78201-78250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/dteam/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'dteamsgm',
        gid           => '78202',
        vo_group      => 'dteam',
        uid_range     => '78251-78260',
        users_num     => 10,
        comment       => 'grid user'
      },
      '/dteam/ROLE=production' => {
        ensure        => 'present',
        group         => 'dteamprd',
        gid           => '78203',
        vo_group      => 'dteam',
        uid_range     => '78261-78270',
        users_num     => 10,
        comment       => 'grid user'
      },
      '/esr'  => {
        ensure => 'present',
        group         => 'esr',
        gid           => '77001',
        vo_group      => 'esr',
        uid_range     => '77001-77050',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/esr/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'esrsgm',
        gid           => '77002',
        vo_group      => 'esr',
        uid_range     => '77101-77150',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/esr/ROLE=production' => {
        ensure        => 'present',
        group         => 'esrprd',
        gid           => '77003',
        vo_group      => 'esr',
        uid_range     => '77151-77200',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/esr/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'esrpil',
        gid           => '77004',
        vo_group      => 'esr',
        uid_range     => '77201-77250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/biomed'  => {
        ensure => 'present',
        group         => 'bio',
        gid           => '74001',
        vo_group      => 'bio',
        uid_range     => '74001-74050',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/biomed/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'biosgm',
        gid           => '74002',
        vo_group      => 'bio',
        uid_range     => '74101-74150',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/biomed/ROLE=production' => {
        ensure        => 'present',
        group         => 'bioprd',
        gid           => '74003',
        vo_group      => 'bio',
        uid_range     => '74151-74200',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/biomed/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'biopil',
        gid           => '74004',
        vo_group      => 'bio',
        uid_range     => '74201-74250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/enmr.eu'  => {
        ensure => 'present',
        group         => 'enmr',
        gid           => '71001',
        vo_group      => 'enmr',
        uid_range     => '71001-71050',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/enmr.eu/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'enmrsgm',
        gid           => '71002',
        vo_group      => 'enmr',
        uid_range     => '71101-71150',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/enmr.eu/ROLE=production' => {
        ensure        => 'present',
        group         => 'enmrprd',
        gid           => '71003',
        vo_group      => 'enmr',
        uid_range     => '71151-71200',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/enmr.eu/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'enmrpil',
        gid           => '71004',
        vo_group      => 'enmr',
        uid_range     => '71201-71250',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/vo.france-asia.org'  => {
        ensure => 'present',
        group         => 'vfa',
        gid           => '71251',
        vo_group      => 'vfa',
        uid_range     => '71251-71300',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/vo.france-asia.org/ROLE=lcgadmin' => {
        ensure        => 'present',
        group         => 'vfasgm',
        gid           => '71252',
        vo_group      => 'vfa',
        uid_range     => '71301-71350',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/vo.france-asia.org/ROLE=production' => {
        ensure        => 'present',
        group         => 'vfaprd',
        gid           => '71253',
        vo_group      => 'vfa',
        uid_range     => '71351-71400',
        users_num     => 50,
        comment       => 'grid user'
      },
      '/vo.france-asia.org/ROLE=pilot'      => {
        ensure        => 'present',
        group         => 'vfapil',
        gid           => '71254',
        vo_group      => 'vfa',
        uid_range     => '71401-71450',
        users_num     => 50,
        comment       => 'grid user'
      },
    }
  }
}
